<!--产能分析-->
<table class="layui-table mt30">
	<thead>
		<tr class="layui-bg-blue">
			<th width="16.6%">品类</th>
			<th width="16.6%">7日平均日产能</th>
			<th width="16.6%">14日平均日产能</th>
			<th width="16.6%">21日平均日产能</th>
			<th width="16.6%">在途产能</th>
			<th width="16.6%">压力系数
			<select id="yali_select"><option value="all">7日-14日-21日</option><option value="7">7日</option><option value="14" selected>14日</option><option value="21">21日</option></select>
			</th>
		</tr>
	</thead>
	<tbody>
		<tr>
			<td>全部</td>
			<td id="getDeliverNotFinish_7_0"><span id="recently7_jianshu">0</span>件<br><span id="recently7_money">0</span>元</td>
			<td id="getDeliverNotFinish_14_0"><span id="recently14_jianshu">0</span>件<br><span id="recently14_money">0</span>元</td>
			<td id="getDeliverNotFinish_21_0"><span id="recently21_jianshu">0</span>件<br><span id="recently21_money">0</span>元</td>
			<td id="getDeliverNotFinish_0">
				<a href="javascript:showDetail('在途产能-订单列表', '{:url('', '_ajax=1&fun=_getCnfx&detail=1&factory_id='.$thisFactoryId.'&from='.$thisFrom)}')" style="text-decoration:underline">
				<span id="recentlyIng_jianshu">0</span>件/
				<span id="recentlyIng_orders">0</span>单<br>
				<span id="recentlyIng_money">0</span>元
			</a>
			</td>
			<td id="getDeliverNotFinish_yali_0"><span id="pressureRate_jianshu">0</span><br><span id="pressureRate_money">0</span></td>
		</tr>
		<tr id="getSkutypeStat_new_data_0">
			<td>针织</td>
			<td id="getDeliverNotFinish_7_1"></td>
			<td id="getDeliverNotFinish_14_1"></td>
			<td id="getDeliverNotFinish_21_1"></td>
			<td id="getDeliverNotFinish_1"></td>
			<td id="getDeliverNotFinish_yali_1"></td>
		</tr>
		<tr id="getSkutypeStat_new_data_1">
			<td>梭织</td>
			<td id="getDeliverNotFinish_7_2"></td>
			<td id="getDeliverNotFinish_14_2"></td>
			<td id="getDeliverNotFinish_21_2"></td>
			<td id="getDeliverNotFinish_2"></td>
			<td id="getDeliverNotFinish_yali_2"></td>
		</tr>
	</tbody>
</table>

<script>
	var getDeliverNotFinish_res={};
layui.use(['jquery', 'layer'], function() {
	var $ = layui.jquery;
	var layer = layui.layer;

	//在途产能--信息查询
	window.getDeliverNotFinish = function() {
		$.ajax({
			type: "POST",
			url: "{:url('getDeliverNotFinishAll')}",
			data: "factory_id="+factoryId+"&from="+from,
			dataType: "json",
			success: function(res){
				getDeliverNotFinish_res=res;
				//在途产能
				var data=res.data.all;
				var url= "{:url('getDeliverNotFinishDetail')}"+"?factory_id="+factoryId+"&from="+from+"&types=all";
				var html='<a href="javascript:showDetail(\'在途产能-订单列表\',\''+url+'\' )" style="text-decoration:underline">' +
						'<span>'+data.all.jianshu+'</span>件/' +
						'<span>'+data.all.num+'</span>单/首单:'+data.all.num_is_new+'个<br>' +
						'<span>'+data.all.money+'</span>元';
				$('#getDeliverNotFinish_0').html(html);
				// var url= "{:url('getDeliverNotFinishDetail')}"+"?factory_id="+factoryId+"&from="+from+"&types=all&sku_type=zhenzhi";
				// var html='<a href="javascript:showDetail(\'在途产能-订单列表\',\''+url+'\' )" style="text-decoration:underline">' +
				// 		'<span>'+data.zhenzhi.jianshu+'</span>件/' +
				// 		'<span>'+data.zhenzhi.num+'</span>单/' +
				// 		'<span>'+data.zhenzhi.money+'</span>元';
				// $('#getDeliverNotFinish_1').html(html);
				// var url= "{:url('getDeliverNotFinishDetail')}"+"?factory_id="+factoryId+"&from="+from+"&types=all&sku_type=shuozhi";
				// var html='<a href="javascript:showDetail(\'在途产能-订单列表\',\''+url+'\' )" style="text-decoration:underline">' +
				// 		'<span>'+data.shuozhi.jianshu+'</span>件/' +
				// 		'<span>'+data.shuozhi.num+'</span>单/' +
				// 		'<span>'+data.shuozhi.money+'</span>元';
				// $('#getDeliverNotFinish_2').html(html);
				html=data.zhenzhi.jianshu+'件/'+data.zhenzhi.num+'单/'+data.zhenzhi.money+'元';
				$('#getDeliverNotFinish_1').html(html);
				html=data.shuozhi.jianshu+'件/'+data.shuozhi.num+'单/'+data.shuozhi.money+'元';
				$('#getDeliverNotFinish_2').html(html);

				//7日平均日产能
				data=res.data.days_avg_7.avg;
				var url= "{:url('getDeliverNotFinishDetail')}"+"?factory_id="+factoryId+"&from="+from+"&types=days_avg_7";
				var html='<a href="javascript:showDetail(\'在途产能-订单列表\',\''+url+'\' )" style="text-decoration:underline">' +
						'<span>'+data.all.jianshu+'</span>件/' +
						'<span>'+data.all.num+'</span>单<br>' +
						'<span>'+data.all.money+'</span>元';
				$('#getDeliverNotFinish_7_0').html(html);
				html=data.zhenzhi.jianshu+'件/'+data.zhenzhi.num+'单/'+data.zhenzhi.money+'元';
				$('#getDeliverNotFinish_7_1').html(html);
				html=data.shuozhi.jianshu+'件/'+data.shuozhi.num+'单/'+data.shuozhi.money+'元';
				$('#getDeliverNotFinish_7_2').html(html);
				//14日平均日产能
				data=res.data.days_avg_14.avg;
				var url= "{:url('getDeliverNotFinishDetail')}"+"?factory_id="+factoryId+"&from="+from+"&types=days_avg_14";
				var html='<a href="javascript:showDetail(\'在途产能-订单列表\',\''+url+'\' )" style="text-decoration:underline">' +
						'<span>'+data.all.jianshu+'</span>件/' +
						'<span>'+data.all.num+'</span>单<br>' +
						'<span>'+data.all.money+'</span>元';
				$('#getDeliverNotFinish_14_0').html(html);
				// var url= "{:url('getDeliverNotFinishDetail')}"+"?factory_id="+factoryId+"&from="+from+"&types=days_avg_14&sku_type=zhenzhi";
				// var html='<a href="javascript:showDetail(\'在途产能-订单列表\',\''+url+'\' )" style="text-decoration:underline">' +
				// 		'<span>'+data.zhenzhi.jianshu+'</span>件/' +
				// 		'<span>'+data.zhenzhi.num+'</span>单/' +
				// 		'<span>'+data.zhenzhi.money+'</span>元';
				// $('#getDeliverNotFinish_14_1').html(html);
				// var url= "{:url('getDeliverNotFinishDetail')}"+"?factory_id="+factoryId+"&from="+from+"&types=days_avg_14&sku_type=shuozhi";
				// var html='<a href="javascript:showDetail(\'在途产能-订单列表\',\''+url+'\' )" style="text-decoration:underline">' +
				// 		'<span>'+data.shuozhi.jianshu+'</span>件/' +
				// 		'<span>'+data.shuozhi.num+'</span>单/' +
				// 		'<span>'+data.shuozhi.money+'</span>元';
				// $('#getDeliverNotFinish_14_2').html(html);
				html=data.zhenzhi.jianshu+'件/'+data.zhenzhi.num+'单/'+data.zhenzhi.money+'元';
				$('#getDeliverNotFinish_14_1').html(html);
				html=data.shuozhi.jianshu+'件/'+data.shuozhi.num+'单/'+data.shuozhi.money+'元';
				$('#getDeliverNotFinish_14_2').html(html);
				//21日平均日产能
				data=res.data.days_avg_21.avg;
				var url= "{:url('getDeliverNotFinishDetail')}"+"?factory_id="+factoryId+"&from="+from+"&types=days_avg_21";
				var html='<a href="javascript:showDetail(\'在途产能-订单列表\',\''+url+'\' )" style="text-decoration:underline">' +
						'<span>'+data.all.jianshu+'</span>件/' +
						'<span>'+data.all.num+'</span>单<br>' +
						'<span>'+data.all.money+'</span>元';
				$('#getDeliverNotFinish_21_0').html(html);
				html=data.zhenzhi.jianshu+'件/'+data.zhenzhi.num+'单/'+data.zhenzhi.money+'元';
				$('#getDeliverNotFinish_21_1').html(html);
				html=data.shuozhi.jianshu+'件/'+data.shuozhi.num+'单/'+data.shuozhi.money+'元';
				$('#getDeliverNotFinish_21_2').html(html);

				//压力系数
				var data14=res.data.yali[14];
				var html=data14.all.jianshu+'<br>' +
						data14.all.money ;
				$('#getDeliverNotFinish_yali_0').html(html);
				html=data14.zhenzhi.jianshu+'<br>' +
						data14.zhenzhi.money ;
				$('#getDeliverNotFinish_yali_1').html(html);
				html=data14.shuozhi.jianshu+'<br>' +
						data14.shuozhi.money ;
				$('#getDeliverNotFinish_yali_2').html(html);
			}
		});
	}
	getDeliverNotFinish();

	$('#yali_select').change(function () {
		var res=getDeliverNotFinish_res;
		switch ($(this).val()) {
			case '7':
				//压力系数
				var data=res.data.yali[7];
				var html=data.all.jianshu+'<br>' +
						data.all.money ;
				$('#getDeliverNotFinish_yali_0').html(html);
				html=data.zhenzhi.jianshu+'<br>' +
						data.zhenzhi.money ;
				$('#getDeliverNotFinish_yali_1').html(html);
				html=data.shuozhi.jianshu+'<br>' +
						data.shuozhi.money ;
				$('#getDeliverNotFinish_yali_2').html(html);
				break;
			case '14':
				//压力系数
				var data14=res.data.yali[14];
				var html=data14.all.jianshu+'<br>' +
						data14.all.money ;
				$('#getDeliverNotFinish_yali_0').html(html);
				html=data14.zhenzhi.jianshu+'<br>' +
					data14.zhenzhi.money ;
				$('#getDeliverNotFinish_yali_1').html(html);
				html=data14.shuozhi.jianshu+'<br>' +
						data14.shuozhi.money ;
				$('#getDeliverNotFinish_yali_2').html(html);
				break;
			case '21':
				//压力系数
				var data=res.data.yali[21];
				var html=data.all.jianshu+'<br>' +
						data.all.money ;
				$('#getDeliverNotFinish_yali_0').html(html);
				html=data.zhenzhi.jianshu+'<br>' +
						data.zhenzhi.money ;
				$('#getDeliverNotFinish_yali_1').html(html);
				html=data.shuozhi.jianshu+'<br>' +
						data.shuozhi.money ;
				$('#getDeliverNotFinish_yali_2').html(html);
				break;
			case 'all':
				//压力系数
				var data7=res.data.yali[7];
				var data14=res.data.yali[14];
				var data21=res.data.yali[21];
				var html=data7.all.jianshu+'-'+data14.all.jianshu+'-'+data21.all.jianshu+'<br>' +
						data7.all.money+'-'+data14.all.money+'-'+data21.all.money+'' ;
				$('#getDeliverNotFinish_yali_0').html(html);
				html=data7.zhenzhi.jianshu+'-'+data14.zhenzhi.jianshu+'-'+data21.zhenzhi.jianshu+'<br>' +
						data7.zhenzhi.money+'-'+data14.zhenzhi.money+'-'+data21.zhenzhi.money+'' ;
				$('#getDeliverNotFinish_yali_1').html(html);
				html=data7.shuozhi.jianshu+'-'+data14.shuozhi.jianshu+'-'+data21.shuozhi.jianshu+'<br>' +
						data7.shuozhi.money+'-'+data14.shuozhi.money+'-'+data21.shuozhi.money+'' ;
				$('#getDeliverNotFinish_yali_2').html(html);
				break;
		}
	});
});
</script>